.class public Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;
.super Ljava/lang/Object;
.source "Dealer2Parser.java"


# static fields
.field private static final VCL_VENDORPRICE:Ljava/lang/String; = "vcl_VendorPrice"

.field private static final VENDORBIZMODE:Ljava/lang/String; = "bizmode"

.field private static final VENDORFULLNAME:Ljava/lang/String; = "vbi_FullName"

.field private static final VENDORID:Ljava/lang/String; = "vendor_id"

.field private static final VENDORNAME:Ljava/lang/String; = "vbi_name"

.field private static final VENDORSALEADDR:Ljava/lang/String; = "vci_SaleAddr"

.field private static final VENDORTEL:Ljava/lang/String; = "vci_SaleTel"


# instance fields
.field private TAG:Ljava/lang/String;

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 38
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 35
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->url:Ljava/lang/String;

    .line 36
    const-string v0, "DealerParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->TAG:Ljava/lang/String;

    .line 39
    iput-object p1, p0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->url:Ljava/lang/String;

    .line 40
    return-void
.end method


# virtual methods
.method public Paser2Object()Ljava/util/ArrayList;
    .locals 10
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/Dealer;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v9, 0x0

    .line 46
    :try_start_0
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->url:Ljava/lang/String;

    invoke-static {v6}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 47
    .local v5, str:Ljava/lang/String;
    if-eqz v5, :cond_1

    .line 48
    new-instance v3, Lorg/json/JSONArray;

    invoke-direct {v3, v5}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V

    .line 50
    .local v3, jObj:Lorg/json/JSONArray;
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lez v6, :cond_1

    .line 51
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 52
    .local v4, list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Dealer;>;"
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lt v2, v6, :cond_0

    move-object v6, v4

    .line 65
    .end local v2           #i:I
    .end local v3           #jObj:Lorg/json/JSONArray;
    .end local v4           #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Dealer;>;"
    .end local v5           #str:Ljava/lang/String;
    :goto_1
    return-object v6

    .line 53
    .restart local v2       #i:I
    .restart local v3       #jObj:Lorg/json/JSONArray;
    .restart local v4       #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Dealer;>;"
    .restart local v5       #str:Ljava/lang/String;
    :cond_0
    invoke-virtual {v3, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v6

    invoke-virtual {p0, v6}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->createDealer(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Dealer;

    move-result-object v0

    .line 54
    .local v0, dea:Lcom/bitauto/autoeasy/selectcar/Object/Dealer;
    invoke-virtual {v4, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    .line 52
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .end local v0           #dea:Lcom/bitauto/autoeasy/selectcar/Object/Dealer;
    .end local v2           #i:I
    .end local v3           #jObj:Lorg/json/JSONArray;
    .end local v4           #list:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lcom/bitauto/autoeasy/selectcar/Object/Dealer;>;"
    :cond_1
    move-object v6, v9

    .line 60
    goto :goto_1

    .line 61
    .end local v5           #str:Ljava/lang/String;
    :catch_0
    move-exception v6

    move-object v1, v6

    .line 62
    .local v1, e:Lorg/json/JSONException;
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer2Parser;->TAG:Ljava/lang/String;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "error :"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v6, v9

    .line 63
    goto :goto_1

    .line 64
    .end local v1           #e:Lorg/json/JSONException;
    :catch_1
    move-exception v6

    move-object v1, v6

    .local v1, e:Lcom/bitauto/autoeasy/tool/WSError;
    move-object v6, v9

    .line 65
    goto :goto_1
.end method

.method public createDealer(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/Dealer;
    .locals 7
    .parameter "obj"

    .prologue
    const-string v2, "vcl_VendorPrice"

    .line 75
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;-><init>()V

    .line 77
    .local v0, dealer:Lcom/bitauto/autoeasy/selectcar/Object/Dealer;
    :try_start_0
    const-string v2, "bizmode"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVendorBizMode(Ljava/lang/String;)V

    .line 78
    const-string v2, "vbi_FullName"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVendorFullName(Ljava/lang/String;)V

    .line 79
    const-string v2, "vendor_id"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVendorID(Ljava/lang/String;)V

    .line 80
    const-string v2, "vbi_name"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVendorName(Ljava/lang/String;)V

    .line 81
    const-string v2, "vci_SaleAddr"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVendorSaleAddr(Ljava/lang/String;)V

    .line 82
    const-string v2, "vci_SaleTel"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setCallCenterNumber(Ljava/lang/String;)V

    .line 83
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "vcl_VendorPrice"

    invoke-virtual {p1, v3}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    const/4 v4, 0x0

    const-string v5, "vcl_VendorPrice"

    invoke-virtual {p1, v5}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/String;->length()I

    move-result v5

    const/4 v6, 0x2

    sub-int/2addr v5, v6

    invoke-virtual {v3, v4, v5}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v3, "\u4e07"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/Dealer;->setVcl_VendorPrice(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 88
    :goto_0
    return-object v2

    .line 85
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 86
    .local v1, e:Lorg/json/JSONException;
    const-string v2, "BrandParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 87
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 88
    const/4 v2, 0x0

    goto :goto_0
.end method
